package com.example.demo.intorcep;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyIntor implements WebMvcConfigurer {

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new LoginIntor())//使用那个拦截器
                    .addPathPatterns("/**")//所有请求都被拦截包括静态资源了。
                    .excludePathPatterns("/", "/login", "/css/**", "/fonts/**", "/images/**", "/js/**");//设置要放行的页面。
        }

}
